package controller

import "music/util/request"

//获取歌单列表
func PlayList(query map[string]interface{}) map[string]interface{} {
	data := map[string]interface{}{}
	if val, ok := query["category"]; ok && val != "" {
		data["cat"] = val
	} else {
		// 全部,华语,欧美,韩语,日语,粤语,小语种,运动,ACG,影视原声,流行,摇滚,后摇,古风,民谣,轻音乐,电子,器乐,说唱,古典,爵士
		data["cat"] = "全部"
	}
	if val, ok := query["limit"]; ok && val != "" {
		data["limit"] = val
	} else {
		data["limit"] = 20
	}
	if val, ok := query["updateTime"]; ok && val != "" {
		data["lasttime"] = val
	} else {
		data["lasttime"] = 0
	}
	data["total"] = true

	result := request.GetRequest("https://music.163.com/api/playlist/highquality/list", data)
	return result

}

//获取歌单信息
func PlayListInfo(query map[string]interface{}) map[string]interface{} {
	data := map[string]interface{}{}
	if val, ok := query["id"]; ok && val != "" {
		data["id"] = val
	} else {
		data["id"] = 3136952023
	}

	data["n"] = 100000
	data["s"] = 8

	result := request.GetRequest("https://music.163.com/api/v6/playlist/detail", data)
	return result
}

//获取歌单分类
func PlayListCat(query map[string]interface{}) map[string]interface{} {
	data := map[string]interface{}{}
	result := request.GetRequest("https://music.163.com/api/playlist/highquality/tags", data)
	return result
}
